package liangtWorkSpace.threadDemo.thread;

import java.util.Random;

/**
 * @author liangt
 * @ClassName: Match3
 * @title: Match3
 * @projectName liangtWorkSpace.threadDemo.thread
 * @description: synchronized -- 示例
 * @date 2020/11/3 11:40
 */
public class Match3 {
    public static void main(String[] args) {
        Couplet couplet = new Couplet();
        for (int i = 0; i < 10000; i ++){
            new Thread(){
              public void run(){
                  int r = new Random().nextInt(2);
                  if (r%2 == 0){
                      couplet.forst();
                  }else {
                      couplet.second();
                  }
              }
            }.start();
        }
    }

}

class Couplet{

    /**
     *
     */
    public void forst(){
        System.out.printf("琴");
        System.out.printf("瑟");
        System.out.printf("琵");
        System.out.printf("琶");
        System.out.println();
    }

    /**
     *
     */
    public void second(){
        System.out.printf("魑");
        System.out.printf("魅");
        System.out.printf("魍");
        System.out.printf("魉");
        System.out.println();
    }
}
